package bz.yfw.example.s3blazeds.part2.helper
{
	import bz.yfw.example.s3blazeds.part2.model.view.EmpViewModel;
	import bz.yfw.example.s3blazeds.part2.view.EmpEditConfirmView;
	import bz.yfw.example.s3blazeds.part2.view.EmpEditThirdView;
	
	import flash.display.BitmapData;
	
	import org.seasar.akabana.yui.framework.ns.viewpart;
	
	import spark.components.Label;
	import spark.components.RadioButton;
	import spark.components.RadioButtonGroup;
	import spark.components.TextInput;
	import spark.components.View;
	import spark.components.supportClasses.ViewReturnObject;
	
	use namespace viewpart;

	/**
	 * 社員編集3確認画面へHelper
	 * @author tokufxug http://twitter.com/tokufxug
	 */ 
	public class EmpEditThirdNextHelper
	{
		public var view:EmpEditThirdView;
		
		viewpart var txtinptEnterCompanyY:TextInput;
		
		viewpart var txtinptEnterCompanyM:TextInput;
		
		viewpart var txtinptEnterCompanyD:TextInput;
		
		viewpart var rdbgrpPosition:RadioButtonGroup;
		
		public function get empViewModel():EmpViewModel {
			if (view.viewModel) {
				return view.viewModel;
			}
			return new EmpViewModel();
		}
		
		public function moveNext(viewClass:Class, imgFace:BitmapData = null):void {
			var vm:EmpViewModel = empViewModel;
			
			vm.enterCompanyY = txtinptEnterCompanyY.text;
			vm.enterCompanyM = txtinptEnterCompanyM.text;
			vm.enterCompanyD = txtinptEnterCompanyD.text;
			if (imgFace && !vm.shashin) {
				vm.shashin = imgFace;
			}
			vm.position = rdbgrpPosition.selectedValue as String;
			view.navigator.pushView(viewClass, vm);
		}
	}
}